<?php

/**
 * Account filter form base class.
 *
 * @package    corpon
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseAccountFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'account_name'     => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'company_name'     => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'company_name_url' => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'company_logo'     => new sfWidgetFormFilterInput(),
      'contract_date'    => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'contract_exp'     => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'contract_term'    => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'ref_contact'      => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'shipping_address' => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'shipping_state'   => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'shipping_city'    => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'shipping_zip'     => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'billing_address'  => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'billing_state'    => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'billing_city'     => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'billing_zip'      => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'billing_phone'    => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'billing_email'    => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'billing_email2'   => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'billing_contact'  => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'created_at'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'account_comments' => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'account_name'     => new sfValidatorPass(array('required' => false)),
      'company_name'     => new sfValidatorPass(array('required' => false)),
      'company_name_url' => new sfValidatorPass(array('required' => false)),
      'company_logo'     => new sfValidatorPass(array('required' => false)),
      'contract_date'    => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'contract_exp'     => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'contract_term'    => new sfValidatorPass(array('required' => false)),
      'ref_contact'      => new sfValidatorPass(array('required' => false)),
      'shipping_address' => new sfValidatorPass(array('required' => false)),
      'shipping_state'   => new sfValidatorPass(array('required' => false)),
      'shipping_city'    => new sfValidatorPass(array('required' => false)),
      'shipping_zip'     => new sfValidatorPass(array('required' => false)),
      'billing_address'  => new sfValidatorPass(array('required' => false)),
      'billing_state'    => new sfValidatorPass(array('required' => false)),
      'billing_city'     => new sfValidatorPass(array('required' => false)),
      'billing_zip'      => new sfValidatorPass(array('required' => false)),
      'billing_phone'    => new sfValidatorPass(array('required' => false)),
      'billing_email'    => new sfValidatorPass(array('required' => false)),
      'billing_email2'   => new sfValidatorPass(array('required' => false)),
      'billing_contact'  => new sfValidatorPass(array('required' => false)),
      'created_at'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'account_comments' => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('account_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Account';
  }

  public function getFields()
  {
    return array(
      'id_account'       => 'Number',
      'account_name'     => 'Text',
      'company_name'     => 'Text',
      'company_name_url' => 'Text',
      'company_logo'     => 'Text',
      'contract_date'    => 'Date',
      'contract_exp'     => 'Date',
      'contract_term'    => 'Text',
      'ref_contact'      => 'Text',
      'shipping_address' => 'Text',
      'shipping_state'   => 'Text',
      'shipping_city'    => 'Text',
      'shipping_zip'     => 'Text',
      'billing_address'  => 'Text',
      'billing_state'    => 'Text',
      'billing_city'     => 'Text',
      'billing_zip'      => 'Text',
      'billing_phone'    => 'Text',
      'billing_email'    => 'Text',
      'billing_email2'   => 'Text',
      'billing_contact'  => 'Text',
      'created_at'       => 'Date',
      'account_comments' => 'Text',
    );
  }
}
